package com.kaifamiao.springbootjwt.exception;

import com.kaifamiao.springbootjwt.config.ResultT;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class SysRuntimeExceptionHandler {
    @ExceptionHandler(TokenRuntimeException.class)
    public ResultT tokenRuntimeException(TokenRuntimeException e) {
        e.printStackTrace();
        return ResultT.error(e.getCode(), e.getMsg());
    }

    @ExceptionHandler(Exception.class)
    public ResultT handlerException(Exception e){
        e.printStackTrace();
        return ResultT.error();
    }
}
